#include "FireRing.h"


void FireRing::InitParticle(Particle &out)
{
	// Time particle is created relative to the global running
	// time of the particle system.
	out.initialTime = m_time;

	// Flare lives for 2-4 seconds.
	out.lifeTime = GetRandomFloat(2.0f, 4.0f);

	// Initial size in pixels.
	out.initialSize = GetRandomFloat(10.0f, 15.0f);

	// Give a very small initial velocity to give the flares
	// some randomness.
	GetRandomVec(out.initialVelocity);

	// Scalar value used in vertex shader as an
	// amplitude factor.
	out.mass = GetRandomFloat(1.0f, 2.0f);

	// Start color at 50-100% intensity when born for
	// variation.
	out.initialColor = GetRandomFloat(0.5f, 1.0f) * D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);

	// Generate random particle on the ring in polar
	// coordinates: random radius and random angle.
	float r = GetRandomFloat(10.0f, 14.0f);
	float t = GetRandomFloat(0, 2.0f*D3DX_PI);

	// Convert to Cartesian coordinates.
	out.initialPosition.x = r*cosf(t);
	out.initialPosition.y = r*sinf(t);

	// Random depth value in [-1, 1] (depth of the ring)
	out.initialPosition.z = GetRandomFloat(-1.0f, 1.0f);

}
